//
//  CNHomeTitleButton.swift
//  Ccweibo
//
//  Created by 陈锦聪 on 16/3/24.
//  Copyright © 2016年 Coco. All rights reserved.
//

import UIKit

class CNHomeTitleButton: UIButton {

    override func layoutSubviews() {
        super.layoutSubviews()
        
        titleLabel!.frame.origin.x = 0
        imageView!.frame.origin.x = titleLabel!.frame.width + 5
    }

    convenience init(title: String?, imageName: String) {
        self.init()
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        sizeToFit()
    }
}
